<?php
session_start();
include(dirname(dirname(dirname(__FILE__)))."/functions/inc/util.inc.php");
include(dirname(dirname(dirname(__FILE__)))."/functions/inc/mydb.inc.php");
include(dirname(dirname(dirname(__FILE__)))."/entidades/moto.class.php");


$db = new mydb();


if(isset($_SESSION["items"]) && $_POST["sucursal_m"]!=0){
    
    $items=  explode("|", $_SESSION["items"]);
    for($i=0;$i<count($items);$i++){
        $moto = new moto($items[$i]);
        $moto->setsuc_id($_POST["sucursal_m"]);
        $moto->upd();
        
    }
    unset($_SESSION["items"]);
    header("Location:/index.php?acc=".$_POST["acc"]."&msg=1");
    die();
}else{
    header("Location:/index.php?acc=".$_POST["acc"]."&msg=2");
    die();
}    
?>
